{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[['5' '0' '0']\n",
      " ['1' '6' '1']\n",
      " ['12' '2' '1']\n",
      " ['10' '3' '3']\n",
      " ['8' '7' '6']\n",
      " ['4' '3' '2']\n",
      " ['0' '4' '1']\n",
      " ['2' '4' '8']\n",
      " ['3' '7' '9']]\n",
      "[['5' '0' '0']\n",
      " ['12' '2' '1']\n",
      " ['4' '3' '2']\n",
      " ['10' '3' '3']\n",
      " ['0' '4' '1']\n",
      " ['2' '4' '8']\n",
      " ['1' '6' '1']\n",
      " ['3' '7' '9']\n",
      " ['8' '7' '6']]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "b = np.array([[\"hhh\",\"ggg\",\"ddd\",\"eee\"],[1,5,0,0],[1,1,6,1],[2,12,2,1],[2,10,3,3],[9,8,7,6],[5,4,3,2],[4,0,4,1],[3,2,4,8],[4,3,7,9]])\n",
    "# print(b)\n",
    "#删除标题行\n",
    "data = np.delete(b,0,0)\n",
    "# 删除了第一列\n",
    "data = np.delete(data,0,1)\n",
    "print(data)\n",
    "#按照第一列主排序，第二列次排序\n",
    "k=np.lexsort(([data[:,0].astype(int)],[data[:,1].astype(int)]))\n",
    "\n",
    "data[:]=data[k]\n",
    "\n",
    "print(data)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[3 4]]\n"
     ]
    }
   ],
   "source": [
    "a=np.array([[1,2],[3,4]])\n",
    "b=np.delete(a,0,0)\n",
    "print(b)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0 2 3 5 6 7 1 4 8]\n",
      "[0 2 3 3 4 4 6 7 7]\n"
     ]
    }
   ],
   "source": [
    "a=np.array([0,6,2,3,7,3,4,4,7])\n",
    "print(np.argsort(a))\n",
    "print(a[np.argsort(a)])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}